import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
//引入ElementPlus组件库相关的内容
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
//引入ElmentPlus图标库相关内容
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
//5.配置根路径
const BASE_URL = 'http://localhost:8080';
//window里面添加的内容是全局内容,我们可以在任意script标签内部使用
window.BASE_URL = BASE_URL;

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
//6.在vue实例中也要添加全局内容,这样才能在template中使用
app.config.globalProperties.BASE_URL =BASE_URL;

app.use(store).use(router).use(ElementPlus).mount('#app')

//7.定义获取用户信息的全局方法
window.getUser =()=>{
    return localStorage.user?JSON.parse(localStorage.user):null;
}
